package slw.core
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	
	
	/**
	 * UISprite
	 * 用于ui的Sprite类
	 * @author ddx<br/>
	 * 2011-6-14
	 *
	 */
	public class UISprite extends Sprite
	{
		//
		/**
		 * 组件显示列表名称，用于toString()方法输出Stage.xxx.xxx，查看显示对象在显示列表中的层级位置 
		 */		
		public var listName:String="";
		
		/**
		 * 构造函数
		 * 
		 */
		public function UISprite()
		{
			super();
			
			listName="UISprite";
		}
		
		/*
		-----------------------------------
		setters getters
		-----------------------------------
		*/
		
		/*
		-----------------------------------
		public  methods
		-----------------------------------
		*/
		
		/*
		-----------------------------------
		private  methods
		-----------------------------------
		*/
		//
		override public function toString():String{
			var $p:*=this;
			var $result:String=$p.listName;
			while($p.parent!=null){
				var $name:String="";
				if($p.parent.hasOwnProperty("listName")){
					$name=$p.parent==this.stage?"Stage":$p.parent.listName;
				}else{
					$name=$p.parent==this.stage?"Stage":$p.parent.name;
				}
				
				$result=$name+"."+$result;
				$p=$p.parent;
			}
			return $result;
		}
	}
}